home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -serious- / programming / other / hexy / src / hexy_winjump.c < prev    next >
C/C++ Source or Header  |  1999-09-06  |  4KB  |  177 lines

  1.  
  2. /*
  3.  * [!BGN - MACHINE GENERATED - DO NOT EDIT THIS HEADER]
  4.  *
  5.  * Program   : Hexy (Binary file viewer/editor for the Amiga.)
  6.  * Version   : 1.6
  7.  * File      : Work:Source/!WIP/HisoftProjects/Hexy/Hexy_winjump.c
  8.  * Author    : Andrew Bell
  9.  * Copyright : Copyright © 1998-1999 Andrew Bell (See GNU GPL)
  10.  * Created   : Saturday 28-Feb-98 16:00:00
  11.  * Modified  : Sunday 22-Aug-99 23:31:45
  12.  * Comment   : 
  13.  *
  14.  * (Generated with StampSource 1.2 by Andrew Bell)
  15.  *
  16.  * [!END - MACHINE GENERATED - DO NOT EDIT THIS HEADER]
  17.  *
  18.  */
  19.  
  20. /* Created: Sun/09/Aug/1998 */
  21.  
  22. /*
  23.  *  Hexy, binary file viewer and editor for the Amiga.
  24.  *  Copyright (C) 1999 Andrew Bell
  25.  *
  26.  *  Author's email address: andrew.ab2000@bigfoot.com
  27.  *
  28.  *  This program is free software; you can redistribute it and/or modify
  29.  *  it under the terms of the GNU General Public License as published by
  30.  *  the Free Software Foundation; either version 2 of the License, or
  31.  *  (at your option) any later version.
  32.  *
  33.  *  This program is distributed in the hope that it will be useful,
  34.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  35.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  36.  *  GNU General Public License for more details.
  37.  *
  38.  *  You should have received a copy of the GNU General Public License
  39.  *  along with this program; if not, write to the Free Software
  40.  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  41.  *
  42.  */
  43.  
  44. #include <Hexy.h>
  45.  
  46. Prototype void ViewJumpWindow( void );
  47. Prototype void ClearJumpWindow( void );
  48. Prototype void UpdateFindWindow( void );
  49. Prototype void IDCMP_JUMP( void );
  50.  
  51. void ViewJumpWindow( void )
  52. {
  53.   /*************************************************
  54.    *
  55.    * 
  56.    *
  57.    */
  58.  
  59.   if ( JUMPWnd )
  60.   {
  61.     WindowToFront( JUMPWnd );
  62.     ActivateWindow( JUMPWnd );
  63.     return;
  64.   }
  65.  
  66.   if (!ValidFile(&VC)) return;
  67.  
  68.   if (!OpenJUMPWindow())
  69.   {
  70.     SwapPort(JUMPWnd, WinPort);
  71.     UpdateJumpWindow();
  72.   }
  73.   else
  74.   {
  75.     CloseJUMPWindow();
  76.   }
  77. }
  78.  
  79. void ClearJumpWindow( void )
  80. {
  81.   /*************************************************
  82.    *
  83.    * 
  84.    *
  85.    */
  86.  
  87.   if (!JUMPWnd) return;
  88.  
  89.   FlushWindow(JUMPWnd);
  90.   CloseJUMPWindow();
  91. }
  92.  
  93. UBYTE TmpBuf[128+4];
  94.  
  95. void UpdateJumpWindow( void )
  96. {
  97.   /*************************************************
  98.    *
  99.    * 
  100.    *
  101.    */
  102.  
  103. }
  104.  
  105. void IDCMP_JUMP( void )
  106. {
  107.   /*************************************************
  108.    *
  109.    * 
  110.    *
  111.    */
  112.  
  113.   switch(IM.Class)
  114.   {
  115.     case IDCMP_CLOSEWINDOW:
  116.       ClearJumpWindow();
  117.       break;
  118.  
  119.     case IDCMP_MOUSEBUTTONS:
  120.     case IDCMP_ACTIVEWINDOW:
  121.       ActivateGadget(JUMPGadgets[GD_FGSTRING], JUMPWnd, NULL);
  122.       break;
  123.  
  124.     case IDCMP_REFRESHWINDOW:
  125.       JUMPRender();
  126.       break;
  127.  
  128.     case IDCMP_GADGETUP:
  129.       switch(Gad->GadgetID)
  130.       {
  131.         case GD_JGSTRING:
  132.         {
  133.           UBYTE *OffsetString;
  134.           ULONG Offset;
  135.           char *Tail;       /* Not used */
  136.           GT_GetGadgetAttrs(JUMPGadgets[GD_JGSTRING], JUMPWnd, NULL, GTST_String, &OffsetString, TAG_DONE);
  137.  
  138.           if (OffsetString[0] == '$')
  139.           {
  140.             Offset = strtoul(OffsetString+1, &Tail, 16);
  141.           }
  142.           else
  143.           {
  144.             Offset = strtoul(OffsetString, &Tail, 0);
  145.           }
  146.  
  147.           /* Note: Do more error checking here */
  148.  
  149.           if (Offset <= VC.VC_FileLength)
  150.           {
  151.             VC.VC_CurrentPoint = Offset;
  152.             UpdateView(&VC, NULL);
  153.           }
  154.           else DisplayBeep(HexyScreen);
  155.  
  156.           UpdateJumpWindow();
  157.           break;
  158.         }
  159.  
  160.         case GD_JGDONE:
  161.           ClearJumpWindow();
  162.           break;
  163.       }
  164.       break;
  165.  
  166.     default:
  167.       break;
  168.   }
  169. }
  170.  
  171. /*************************************************
  172.  *
  173.  * 
  174.  *
  175.  */
  176.  
  177.